package com.red.star.macalline.sched.task;

import com.red.star.macalline.sched.service.SmsService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;

import javax.annotation.Resource;

/**
 * @author nofish.yan@gmail.com
 * @date 2018/3/21.
 * 发送短信定时器
 */
@Configuration
@EnableScheduling
public class SmsTask {

    private static final Logger logger = LoggerFactory.getLogger(SmsTask.class);

    @Resource
    private SmsService smsService;

    @Scheduled(cron = "0 0/1 8-22 * * ?")
    public void sendSms() {
        System.out.println("定时器执行");
        smsService.sendMsgToAwakenChat();
    }
}
